Carbon


KCSetAttribute

Header: Keychain.h Carbon status: Under Evaluation

Sets or edits keychain item data using a keychain item attribute structure.

OSStatus KCSetAttribute (
    KCItemRef item, 
    KCAttribute *attr
);
Parameter descriptions
item

A reference to the keychain item whose data you wish to set or edit.

attr

A pointer to a structure of type KCAttribute containing keychain item data you want to set. Before calling KCSetAttribute, fill in the tag, length, and data fields of this structure with the tag identifying the attribute you wish to modify or set, the length of the attribute data you wish to set, and a pointer to that data, respectively.

function result

A result code. The result code errKCInvalidItemRef indicates that the keychain item reference was invalid. The result code errKCNoSuchAttr indicates that the item attribute you wish to set is undefined for the specified item. The result code errKCDataTooLarge indicates that more data was supplied than is allowed for this attribute.

DISCUSSION

You can call KCSetAttribute or the function KCSetData to set or modify keychain item data. The difference between the functions is that KCSetData requires that you pass the length of the data and a pointer to that data as separate parameters rather than fields in a keychain item attribute structure.

If the keychain that contains the item is locked, before calling KCSetAttribute you should call the function KCUnlock to prompt the user to unlock the keychain. The keychain must permit read/write access in order to modify keychain item data.

You can only set or modify standard item attributes identified by the tag constants kDescriptionKCItemAttr, kCommentKCItemAttr, kLabelKCItemAttr, kCreatorKCItemAttr, kTypeKCItemAttr, and kCustomIconKCItemAttr. In addition, each class of keychain item has attributes specific to that class which may be set or modified. See “Keychain Item Data Tag Constants” for more information.

VERSION NOTES

Available beginning with Keychain Manager 1.0.


© 2000 Apple Computer, Inc. (Last Updated 7/17/2000)